package com.security.door.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.security.door.core.base.BaseService;
import com.security.door.dao.mapper.devDevicetypeMapper;
import com.security.door.model.domain.devDevicetype;
import com.security.door.model.dto.devDevicetypeDto;
import com.security.door.model.vo.treeDataVo;
import com.security.door.service.IdevDevicetypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class devDevicetypeServiceImpl extends BaseService<devDevicetype> implements IdevDevicetypeService {

    @Autowired
    devDevicetypeMapper idevDevicetypeMapper;

    public PageInfo<devDevicetype> queryListWithPage(devDevicetypeDto entity) {
        PageHelper.startPage(entity.getPageIndex(), entity.getPageSize());
        var actionList = idevDevicetypeMapper.queryListWithPage(entity);
        return new PageInfo<>(actionList);
    }

    public boolean hasExists(String devicetypecode) {
        return idevDevicetypeMapper.hasExists(devicetypecode) > 0 ? true : false;
    }

    public Integer delByTypeCode(String typeCode) {
        return idevDevicetypeMapper.delByTypeCode(typeCode);
    }

    public List<treeDataVo> selectDevTypeTree() {
        return idevDevicetypeMapper.selectDevTypeTree();
    }
}
